using DapperExtensions.Mapper;

namespace Read.Models
{
    public class ArchivesMapper : ClassMapper<ArchivesModel>
    {
        /// <summary>
        /// 字段映射
        /// </summary>
        public ArchivesMapper()
        {
            Table(Tables.Archives);
            Map(c => c.Id).Column("Id").Key(KeyType.Identity);
            Map(c => c.Title).Column("Title");
            Map(c => c.CategoryId).Column("CategoryId");
            Map(c => c.Content).Column("Content");
            Map(c => c.CreateTime).Column("CreateTime");
            Map(c => c.UpdateTime).Column("UpdateTime");
            Map(c => c.ReadNumber).Column("ReadNumber");
        }
    }
    
    /// <summary>
    /// 文章类
    /// </summary>
    public class ArchivesModel
    {
        /// <summary>
        /// 文章Id
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 文章标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 栏目Id
        /// </summary>
        public int CategoryId { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public int CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public int UpdateTime { get; set; }

        /// <summary>
        /// 阅读数量
        /// </summary>
        public int ReadNumber { get; set; }
    }
}